package composite_pattern;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author 申书航
 * @version 1.0
 * 消息类，负责生成不同的消息内容
 */
public class Message {

    /**
     * 创建Hello消息
     * @return 返回一个包含"Hello My World"的句子
     */
    public LetterComposite MessageHello() {
        List<Word> words = new ArrayList<>();
        Collections.addAll(words,
                new Word('H','e','l','l','o'),
                new Word('M','y'),
                new Word('W','o','r','l','d')
                );
        return new Sentence(words);
    }

    /**
     * 创建Nice to meet you消息
     * @return 返回一个包含"Nice To Meet You"的句子
     */
    public LetterComposite MessageNiceToMeetYou() {
        List<Word> words = new ArrayList<>();
        Collections.addAll(words,
                new Word('N','i','c','e'),
                new Word('T','o'),
                new Word('M','e','e','t'),
                new Word('Y','o','u')
                );
        return new Sentence(words);
    }

}
